home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 26 / AACD 26.iso / AACD / Programming / AllPlaton / Unsorted / QTan.AMOS / QTan.amosSourceCode
Encoding:
AMOS Source Code  |  1995-12-20  |  962 b   |  53 lines

  1. Degree 
  2. Screen Open 0,320,256,2,0
  3. Curs Off : Flash Off : Paper 0 : Pen 1 : Cls 
  4. Reserve As Work 9,514
  5. ST=Start(9)
  6. For A=0 To 512
  7.   Poke ST+A,((Atan(A/512.0)*1024))/360
  8. Next 
  9. Do 
  10.   MX=X Screen(X Mouse)
  11.   MY=Y Screen(Y Mouse)
  12.   Wait Vbl 
  13.   Cls 
  14.   DX=(160-MX)
  15.   DY=(100-MY)
  16.   If DX<>0
  17.     W=Atan(((DY*256)/DX)/256.0)
  18.   Else 
  19.     If DY<0
  20.       W=90
  21.     Else 
  22.       W=270
  23.     End If 
  24.   End If 
  25.   If DX>0 Then Add W,180
  26.   W=(W+360) mod 360
  27.   Draw 160,100 To 160+Cos(W)*16,100+Sin(W)*16
  28.   Locate 0,20 : Print W;
  29. ' NEW TAN! 
  30.   If DX=>0 Then XABS=DX Else XABS=-DX
  31.   If DY=>0 Then YABS=DY Else YABS=-DY
  32.   If YABS<=XABS
  33.     WW=Peek(ST+(YABS*512)/XABS)+512
  34.   Else 
  35.     WW=768-Peek(ST+(XABS*512)/YABS)
  36.   End If 
  37.   If DX=>0
  38.     If DY>0
  39.       W=WW
  40.     Else 
  41.       W=-WW
  42.     End If 
  43.   Else 
  44.     If DY>0
  45.       W=512-WW
  46.     Else 
  47.       W=WW-512
  48.     End If 
  49.   End If 
  50.   W=W and $3FF
  51.   Draw 120,100 To 120+ Extension_8_1114(W,16),100+ Extension_8_1106(W,16)
  52.   Print(W*360)/1024
  53. Loop